package com.itheima;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/servltDemo02")
public class ServltDemo02 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //调整格式
        resp.setContentType("text/html:charset=UTF-8");
        String news = "幺幺幺幺幺";
        //设置缓存
        resp.setDateHeader("Expires",System.currentTimeMillis()+1*60*60*1000);
        //写出数据
        resp.getWriter().write(news);

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
